class Auditor < ActiveRecord::Base
  has_many :products
  has_many :purchases
  
  belongs_to :department
  belongs_to :role


  #通过审批人编号和姓名检索审批人列表
  def self.findAuditors auditor_number,auditor_name,state,auditor_type,pageBegin,pageEnd
    find(:all,:conditions => ['login_id like ? and name like ? and auditing_status like ? and auditor_type = ?','%'+auditor_number+'%','%'+auditor_name+'%','%'+state+'%',auditor_type],:offset=>pageBegin.to_i,:limit =>pageEnd.to_i)

  end

  #通过审批人编号查找审批人
  def self.findByNumber number
    find(:first,:conditions => ['login_id = ?',number])
  end
end
